<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>原生JS的事件三种方式</title>
</head>
<body>
    <div id="app">
        <button onclick="clickeMe1()">点击我1</button>
        <button id="btn2">点击我2</button>
        <button id="btn3">点击我3</button>
    </div>
</body>
</html>
<script>
    function $(id){
        return document.getElementById(id);
    }
    function clickeMe1(){
        window.alert("单击我1");
    }
    //当加载页面的时候会调用此方法
    window.onload=function(){
        $("btn2").addEventListener('click',function(){
            window.alert("点击我2");
        });
        
        $("btn3").onclick=function(){
            window.alert("点击我3");
        }
    };
</script>